using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.Security;
using System.Windows.Forms;
using System.Resources;

using System.Data;
using System.Drawing.PieChart;

using XPExplorerBar;
using XPTable;
using XPTable.Editors;
using XPTable.Models;
using ZedGraph;

namespace View
{

	#region SystemView
	
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class SystemView : System.Windows.Forms.Form
	{
        private IContainer components;
		#region Class Data

        private XPExplorerBar.TaskPane systemTaskPane;
		private XPExplorerBar.TaskItem printPicturesTaskItem;
		private XPExplorerBar.TaskItem copyToCDTaskItem;
        private XPExplorerBar.TaskItem myNetworkPlacesTaskItem;
		private XPExplorerBar.TaskItem customTaskItem1;
		private XPExplorerBar.TaskItem customTaskItem2;
		private XPExplorerBar.TaskItem customTaskItem3;
		private TaskPaneDescriptor customTaskPaneDescriptor;
		private ExpandoDescriptor customExpandoDescriptor;
		private TaskItemDescriptor customTaskItem1Descriptor;
		private TaskItemDescriptor customTaskItem2Descriptor;
		private TaskItemDescriptor customTaskItem3Descriptor;
		private System.Windows.Forms.Button customButton;
		private XPExplorerBar.XPTextBox customTextBox;
		private System.Windows.Forms.ComboBox customComboBox;
		private System.Windows.Forms.CheckBox customCheckBox;
		private System.Windows.Forms.RadioButton customRadioButton;
		private System.Windows.Forms.MainMenu menubar;
		private System.Windows.Forms.MenuItem fileMenu;
		private System.Windows.Forms.MenuItem viewMenu;
		private System.Windows.Forms.MenuItem exitMenuItem;
		private System.Windows.Forms.MenuItem animateMenuItem;
		private System.Windows.Forms.MenuItem themesMenuItem;
		private System.Windows.Forms.MenuItem classicMenuItem;
		private System.Windows.Forms.MenuItem defaultMenuItem;
		private System.Windows.Forms.MenuItem blueMenuItem;
		private System.Windows.Forms.MenuItem xboxMenuItem;
		private System.Windows.Forms.MenuItem itunesMenuItem;
		private System.Windows.Forms.MenuItem pantherMenuItem;
		private System.Windows.Forms.MenuItem bwMenuItem;
		private System.Windows.Forms.MenuItem myPicturesMenuItem;
		private System.Windows.Forms.MenuItem myComputerMenuItem;
		private System.Windows.Forms.MenuItem myNetworkMenuItem;
		private System.Windows.Forms.MenuItem cycleMenuItem;
		private System.Windows.Forms.MenuItem separatorMenuItem2;
		private System.Windows.Forms.MenuItem separatorMenuItem1;
		private System.Windows.Forms.MenuItem expandoDraggingMenuItem;
		private System.Windows.Forms.GroupBox transactionsBox;
		private System.Windows.Forms.GroupBox loginBox;
		private System.Windows.Forms.PictureBox loginBoxPicture;
		private System.Windows.Forms.Button newUserButton;
		private System.Windows.Forms.Button loginButton;
		private System.Windows.Forms.TextBox passwordBox;
		private System.Windows.Forms.TextBox usernameBox;
		private XPExplorerBar.Expando transactionTasks;
		private XPExplorerBar.TaskItem addNewTxButton;
		private XPExplorerBar.TaskItem searchTxButton;
		private XPExplorerBar.Expando accountTasks;
		private XPExplorerBar.TaskItem addAccountButton;
		private XPExplorerBar.TaskItem editAccountButton;
		private XPExplorerBar.TaskItem deleteAccountButton;
		private XPExplorerBar.Expando toolsTasks;
		private XPExplorerBar.TaskItem monthlySummaryButton;
		private XPExplorerBar.TaskItem loansButton;
		private XPExplorerBar.TaskItem recurringPaymentButton;
		private XPExplorerBar.Expando profileTask;
		private System.Windows.Forms.Label userNameLabel;
		private System.Windows.Forms.Label lastLoggedInLabel;
		private XPTable.Models.Table transactionTable;
		private System.Windows.Forms.MenuItem showFocusMenuItem;
		private PinkieControls.ButtonXP addButton;
		private System.Windows.Forms.MenuItem logoutMenuItem;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.Label lastLoggedLabel;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		private XPExplorerBar.TaskItem editProfileButton;
		private System.Windows.Forms.Label numOfTransaction;

		private Model.UserManager manager;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuItem5;
		private System.Windows.Forms.CheckBox rememberBox;
		private int flag = 0;
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private ZedGraph.ZedGraphControl zedGraphControl1;
		private System.Windows.Forms.TabPage tabPage3;
		private System.Windows.Forms.ListBox accountSummaryBox;
        private TabPage tabSharedTxSummary;
        private TextBox sharedBillsText;

		ResourceManager myManager; 

		#endregion


		#region Constructor

		/// <summary>
		/// 
		/// </summary>
		public SystemView(Model.UserManager myUser)
		{
			InitializeComponent();
			this.transactionsBox.Visible = false;
			this.accountSummaryBox.Visible = false;
			this.tabControl1.Visible = false;
			if(MizClient.MizClient.isUserCredentialsRemembered())
			{
				usernameBox.Text = MizClient.MizClient.RememberedUserName;
				passwordBox.Text = MizClient.MizClient.RememberedUserPassword;
				rememberBox.Checked = true;
			}
			
			this.systemTaskPane.Enabled = false;
			this.manager = myUser;
			this.manager.TransactionAction += new Model.UserManager.TransactionEventHandler(updateTransaction);
            this.manager.ServiceDisconnectedAction += new Model.UserManager.ServiceDisconnectedEventHandler(onServerDisconnected);
		}

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SystemView));
            this.systemTaskPane = new XPExplorerBar.TaskPane();
            this.transactionTasks = new XPExplorerBar.Expando();
            this.addNewTxButton = new XPExplorerBar.TaskItem();
            this.searchTxButton = new XPExplorerBar.TaskItem();
            this.printPicturesTaskItem = new XPExplorerBar.TaskItem();
            this.copyToCDTaskItem = new XPExplorerBar.TaskItem();
            this.accountTasks = new XPExplorerBar.Expando();
            this.addAccountButton = new XPExplorerBar.TaskItem();
            this.editAccountButton = new XPExplorerBar.TaskItem();
            this.deleteAccountButton = new XPExplorerBar.TaskItem();
            this.toolsTasks = new XPExplorerBar.Expando();
            this.monthlySummaryButton = new XPExplorerBar.TaskItem();
            this.loansButton = new XPExplorerBar.TaskItem();
            this.recurringPaymentButton = new XPExplorerBar.TaskItem();
            this.myNetworkPlacesTaskItem = new XPExplorerBar.TaskItem();
            this.profileTask = new XPExplorerBar.Expando();
            this.userNameLabel = new System.Windows.Forms.Label();
            this.lastLoggedInLabel = new System.Windows.Forms.Label();
            this.lastLoggedLabel = new System.Windows.Forms.Label();
            this.editProfileButton = new XPExplorerBar.TaskItem();
            this.transactionsBox = new System.Windows.Forms.GroupBox();
            this.numOfTransaction = new System.Windows.Forms.Label();
            this.transactionTable = new XPTable.Models.Table();
            this.customTaskItem1 = new XPExplorerBar.TaskItem();
            this.customTaskItem2 = new XPExplorerBar.TaskItem();
            this.customTaskItem3 = new XPExplorerBar.TaskItem();
            this.customButton = new System.Windows.Forms.Button();
            this.customTextBox = new XPExplorerBar.XPTextBox();
            this.customComboBox = new System.Windows.Forms.ComboBox();
            this.customCheckBox = new System.Windows.Forms.CheckBox();
            this.customRadioButton = new System.Windows.Forms.RadioButton();
            this.menubar = new System.Windows.Forms.MainMenu(this.components);
            this.fileMenu = new System.Windows.Forms.MenuItem();
            this.logoutMenuItem = new System.Windows.Forms.MenuItem();
            this.exitMenuItem = new System.Windows.Forms.MenuItem();
            this.viewMenu = new System.Windows.Forms.MenuItem();
            this.animateMenuItem = new System.Windows.Forms.MenuItem();
            this.themesMenuItem = new System.Windows.Forms.MenuItem();
            this.classicMenuItem = new System.Windows.Forms.MenuItem();
            this.blueMenuItem = new System.Windows.Forms.MenuItem();
            this.xboxMenuItem = new System.Windows.Forms.MenuItem();
            this.itunesMenuItem = new System.Windows.Forms.MenuItem();
            this.pantherMenuItem = new System.Windows.Forms.MenuItem();
            this.bwMenuItem = new System.Windows.Forms.MenuItem();
            this.defaultMenuItem = new System.Windows.Forms.MenuItem();
            this.cycleMenuItem = new System.Windows.Forms.MenuItem();
            this.expandoDraggingMenuItem = new System.Windows.Forms.MenuItem();
            this.separatorMenuItem1 = new System.Windows.Forms.MenuItem();
            this.showFocusMenuItem = new System.Windows.Forms.MenuItem();
            this.separatorMenuItem2 = new System.Windows.Forms.MenuItem();
            this.myPicturesMenuItem = new System.Windows.Forms.MenuItem();
            this.myComputerMenuItem = new System.Windows.Forms.MenuItem();
            this.myNetworkMenuItem = new System.Windows.Forms.MenuItem();
            this.menuItem4 = new System.Windows.Forms.MenuItem();
            this.menuItem5 = new System.Windows.Forms.MenuItem();
            this.menuItem1 = new System.Windows.Forms.MenuItem();
            this.menuItem3 = new System.Windows.Forms.MenuItem();
            this.menuItem2 = new System.Windows.Forms.MenuItem();
            this.loginBox = new System.Windows.Forms.GroupBox();
            this.rememberBox = new System.Windows.Forms.CheckBox();
            this.newUserButton = new System.Windows.Forms.Button();
            this.loginButton = new System.Windows.Forms.Button();
            this.passwordBox = new System.Windows.Forms.TextBox();
            this.usernameBox = new System.Windows.Forms.TextBox();
            this.loginBoxPicture = new System.Windows.Forms.PictureBox();
            this.addButton = new PinkieControls.ButtonXP();
            this.tabControl1 = new System.Windows.Forms.TabControl();
            this.tabPage1 = new System.Windows.Forms.TabPage();
            this.zedGraphControl1 = new ZedGraph.ZedGraphControl();
            this.tabPage3 = new System.Windows.Forms.TabPage();
            this.accountSummaryBox = new System.Windows.Forms.ListBox();
            this.tabSharedTxSummary = new System.Windows.Forms.TabPage();
            this.sharedBillsText = new System.Windows.Forms.TextBox();
            ((System.ComponentModel.ISupportInitialize)(this.systemTaskPane)).BeginInit();
            this.systemTaskPane.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.transactionTasks)).BeginInit();
            this.transactionTasks.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.accountTasks)).BeginInit();
            this.accountTasks.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.toolsTasks)).BeginInit();
            this.toolsTasks.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.profileTask)).BeginInit();
            this.profileTask.SuspendLayout();
            this.transactionsBox.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.transactionTable)).BeginInit();
            this.loginBox.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.loginBoxPicture)).BeginInit();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            this.tabPage3.SuspendLayout();
            this.tabSharedTxSummary.SuspendLayout();
            this.SuspendLayout();
            // 
            // systemTaskPane
            // 
            this.systemTaskPane.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)));
            this.systemTaskPane.AutoScrollMargin = new System.Drawing.Size(12, 12);
            this.systemTaskPane.Expandos.AddRange(new XPExplorerBar.Expando[] {
            this.transactionTasks,
            this.accountTasks,
            this.toolsTasks,
            this.profileTask});
            this.systemTaskPane.Location = new System.Drawing.Point(0, 0);
            this.systemTaskPane.Name = "systemTaskPane";
            this.systemTaskPane.Size = new System.Drawing.Size(210, 600);
            this.systemTaskPane.TabIndex = 0;
            this.systemTaskPane.Text = "System TaskPane";
            // 
            // transactionTasks
            // 
            this.transactionTasks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.transactionTasks.AutoLayout = true;
            this.transactionTasks.ExpandedHeight = 111;
            this.transactionTasks.Font = new System.Drawing.Font("Tahoma", 8.25F);
            this.transactionTasks.Items.AddRange(new System.Windows.Forms.Control[] {
            this.addNewTxButton,
            this.searchTxButton,
            this.printPicturesTaskItem,
            this.copyToCDTaskItem});
            this.transactionTasks.Location = new System.Drawing.Point(0, 0);
            this.transactionTasks.Name = "transactionTasks";
            this.transactionTasks.Size = new System.Drawing.Size(210, 111);
            this.transactionTasks.SpecialGroup = true;
            this.transactionTasks.TabIndex = 0;
            this.transactionTasks.Text = "Transaction Tasks";
            // 
            // addNewTxButton
            // 
            this.addNewTxButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.addNewTxButton.BackColor = System.Drawing.Color.Transparent;
            this.addNewTxButton.Image = null;
            this.addNewTxButton.Location = new System.Drawing.Point(0, 29);
            this.addNewTxButton.Name = "addNewTxButton";
            this.addNewTxButton.Size = new System.Drawing.Size(206, 16);
            this.addNewTxButton.TabIndex = 0;
            this.addNewTxButton.Text = "Add new transaction";
            this.addNewTxButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.addNewTxButton.UseVisualStyleBackColor = false;
            this.addNewTxButton.Click += new System.EventHandler(this.addNewTxButton_Click);
            // 
            // searchTxButton
            // 
            this.searchTxButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.searchTxButton.BackColor = System.Drawing.Color.Transparent;
            this.searchTxButton.Enabled = false;
            this.searchTxButton.Image = null;
            this.searchTxButton.Location = new System.Drawing.Point(0, 49);
            this.searchTxButton.Name = "searchTxButton";
            this.searchTxButton.Size = new System.Drawing.Size(206, 16);
            this.searchTxButton.TabIndex = 1;
            this.searchTxButton.Text = "Search transaction";
            this.searchTxButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.searchTxButton.UseVisualStyleBackColor = false;
            // 
            // printPicturesTaskItem
            // 
            this.printPicturesTaskItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.printPicturesTaskItem.BackColor = System.Drawing.Color.Transparent;
            this.printPicturesTaskItem.Image = null;
            this.printPicturesTaskItem.Location = new System.Drawing.Point(0, 69);
            this.printPicturesTaskItem.Name = "printPicturesTaskItem";
            this.printPicturesTaskItem.Size = new System.Drawing.Size(206, 16);
            this.printPicturesTaskItem.TabIndex = 2;
            this.printPicturesTaskItem.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.printPicturesTaskItem.UseVisualStyleBackColor = false;
            // 
            // copyToCDTaskItem
            // 
            this.copyToCDTaskItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.copyToCDTaskItem.BackColor = System.Drawing.Color.Transparent;
            this.copyToCDTaskItem.Image = null;
            this.copyToCDTaskItem.Location = new System.Drawing.Point(0, 89);
            this.copyToCDTaskItem.Name = "copyToCDTaskItem";
            this.copyToCDTaskItem.Size = new System.Drawing.Size(206, 16);
            this.copyToCDTaskItem.TabIndex = 3;
            this.copyToCDTaskItem.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.copyToCDTaskItem.UseVisualStyleBackColor = false;
            // 
            // accountTasks
            // 
            this.accountTasks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.accountTasks.AutoLayout = true;
            this.accountTasks.ExpandedHeight = 92;
            this.accountTasks.Font = new System.Drawing.Font("Tahoma", 8.25F);
            this.accountTasks.Items.AddRange(new System.Windows.Forms.Control[] {
            this.addAccountButton,
            this.editAccountButton,
            this.deleteAccountButton});
            this.accountTasks.Location = new System.Drawing.Point(0, 111);
            this.accountTasks.Name = "accountTasks";
            this.accountTasks.Size = new System.Drawing.Size(210, 92);
            this.accountTasks.TabIndex = 1;
            this.accountTasks.Text = "Account Tasks";
            // 
            // addAccountButton
            // 
            this.addAccountButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.addAccountButton.BackColor = System.Drawing.Color.Transparent;
            this.addAccountButton.Image = null;
            this.addAccountButton.Location = new System.Drawing.Point(0, 29);
            this.addAccountButton.Name = "addAccountButton";
            this.addAccountButton.Size = new System.Drawing.Size(204, 16);
            this.addAccountButton.TabIndex = 0;
            this.addAccountButton.Text = "Add Account";
            this.addAccountButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.addAccountButton.UseVisualStyleBackColor = false;
            this.addAccountButton.Click += new System.EventHandler(this.addAccountButton_Click);
            // 
            // editAccountButton
            // 
            this.editAccountButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.editAccountButton.BackColor = System.Drawing.Color.Transparent;
            this.editAccountButton.Enabled = false;
            this.editAccountButton.Image = null;
            this.editAccountButton.Location = new System.Drawing.Point(0, 49);
            this.editAccountButton.Name = "editAccountButton";
            this.editAccountButton.Size = new System.Drawing.Size(204, 16);
            this.editAccountButton.TabIndex = 1;
            this.editAccountButton.Text = "Edit Account";
            this.editAccountButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.editAccountButton.UseVisualStyleBackColor = false;
            // 
            // deleteAccountButton
            // 
            this.deleteAccountButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.deleteAccountButton.BackColor = System.Drawing.Color.Transparent;
            this.deleteAccountButton.Enabled = false;
            this.deleteAccountButton.Image = null;
            this.deleteAccountButton.Location = new System.Drawing.Point(0, 69);
            this.deleteAccountButton.Name = "deleteAccountButton";
            this.deleteAccountButton.Size = new System.Drawing.Size(204, 16);
            this.deleteAccountButton.TabIndex = 2;
            this.deleteAccountButton.Text = "Delete Account";
            this.deleteAccountButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.deleteAccountButton.UseVisualStyleBackColor = false;
            // 
            // toolsTasks
            // 
            this.toolsTasks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.toolsTasks.AutoLayout = true;
            this.toolsTasks.Enabled = false;
            this.toolsTasks.ExpandedHeight = 112;
            this.toolsTasks.Font = new System.Drawing.Font("Tahoma", 8.25F);
            this.toolsTasks.Items.AddRange(new System.Windows.Forms.Control[] {
            this.monthlySummaryButton,
            this.loansButton,
            this.recurringPaymentButton,
            this.myNetworkPlacesTaskItem});
            this.toolsTasks.Location = new System.Drawing.Point(0, 203);
            this.toolsTasks.Name = "toolsTasks";
            this.toolsTasks.Size = new System.Drawing.Size(210, 112);
            this.toolsTasks.TabIndex = 2;
            this.toolsTasks.Text = "Tools";
            // 
            // monthlySummaryButton
            // 
            this.monthlySummaryButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.monthlySummaryButton.BackColor = System.Drawing.Color.Transparent;
            this.monthlySummaryButton.Image = null;
            this.monthlySummaryButton.Location = new System.Drawing.Point(0, 29);
            this.monthlySummaryButton.Name = "monthlySummaryButton";
            this.monthlySummaryButton.Size = new System.Drawing.Size(204, 16);
            this.monthlySummaryButton.TabIndex = 0;
            this.monthlySummaryButton.Text = "Monthly Summary";
            this.monthlySummaryButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.monthlySummaryButton.UseVisualStyleBackColor = false;
            // 
            // loansButton
            // 
            this.loansButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.loansButton.BackColor = System.Drawing.Color.Transparent;
            this.loansButton.Image = null;
            this.loansButton.Location = new System.Drawing.Point(0, 49);
            this.loansButton.Name = "loansButton";
            this.loansButton.Size = new System.Drawing.Size(204, 16);
            this.loansButton.TabIndex = 1;
            this.loansButton.Text = "Loans";
            this.loansButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.loansButton.UseVisualStyleBackColor = false;
            // 
            // recurringPaymentButton
            // 
            this.recurringPaymentButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.recurringPaymentButton.BackColor = System.Drawing.Color.Transparent;
            this.recurringPaymentButton.Image = null;
            this.recurringPaymentButton.Location = new System.Drawing.Point(0, 69);
            this.recurringPaymentButton.Name = "recurringPaymentButton";
            this.recurringPaymentButton.Size = new System.Drawing.Size(204, 16);
            this.recurringPaymentButton.TabIndex = 2;
            this.recurringPaymentButton.Text = "Recurring payments";
            this.recurringPaymentButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.recurringPaymentButton.UseVisualStyleBackColor = false;
            // 
            // myNetworkPlacesTaskItem
            // 
            this.myNetworkPlacesTaskItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.myNetworkPlacesTaskItem.BackColor = System.Drawing.Color.Transparent;
            this.myNetworkPlacesTaskItem.Image = null;
            this.myNetworkPlacesTaskItem.Location = new System.Drawing.Point(0, 89);
            this.myNetworkPlacesTaskItem.Name = "myNetworkPlacesTaskItem";
            this.myNetworkPlacesTaskItem.Size = new System.Drawing.Size(204, 16);
            this.myNetworkPlacesTaskItem.TabIndex = 3;
            this.myNetworkPlacesTaskItem.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.myNetworkPlacesTaskItem.UseVisualStyleBackColor = false;
            // 
            // profileTask
            // 
            this.profileTask.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.profileTask.ExpandedHeight = 103;
            this.profileTask.Font = new System.Drawing.Font("Tahoma", 8.25F);
            this.profileTask.Items.AddRange(new System.Windows.Forms.Control[] {
            this.userNameLabel,
            this.lastLoggedInLabel,
            this.lastLoggedLabel,
            this.editProfileButton});
            this.profileTask.Location = new System.Drawing.Point(0, 315);
            this.profileTask.Name = "profileTask";
            this.profileTask.Size = new System.Drawing.Size(210, 103);
            this.profileTask.TabIndex = 3;
            this.profileTask.Text = "Profile";
            // 
            // userNameLabel
            // 
            this.userNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.userNameLabel.BackColor = System.Drawing.Color.Transparent;
            this.userNameLabel.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.userNameLabel.Location = new System.Drawing.Point(12, 33);
            this.userNameLabel.Name = "userNameLabel";
            this.userNameLabel.Size = new System.Drawing.Size(186, 14);
            this.userNameLabel.TabIndex = 0;
            // 
            // lastLoggedInLabel
            // 
            this.lastLoggedInLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.lastLoggedInLabel.BackColor = System.Drawing.Color.Transparent;
            this.lastLoggedInLabel.Location = new System.Drawing.Point(12, 72);
            this.lastLoggedInLabel.Name = "lastLoggedInLabel";
            this.lastLoggedInLabel.Size = new System.Drawing.Size(91, 14);
            this.lastLoggedInLabel.TabIndex = 2;
            this.lastLoggedInLabel.Text = "Last logged in:";
            // 
            // lastLoggedLabel
            // 
            this.lastLoggedLabel.Location = new System.Drawing.Point(11, 86);
            this.lastLoggedLabel.Name = "lastLoggedLabel";
            this.lastLoggedLabel.Size = new System.Drawing.Size(166, 14);
            this.lastLoggedLabel.TabIndex = 3;
            // 
            // editProfileButton
            // 
            this.editProfileButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.editProfileButton.BackColor = System.Drawing.Color.Transparent;
            this.editProfileButton.Image = null;
            this.editProfileButton.Location = new System.Drawing.Point(13, 48);
            this.editProfileButton.Name = "editProfileButton";
            this.editProfileButton.Size = new System.Drawing.Size(185, 16);
            this.editProfileButton.TabIndex = 4;
            this.editProfileButton.Text = "Edit profile";
            this.editProfileButton.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.editProfileButton.UseVisualStyleBackColor = false;
            this.editProfileButton.Click += new System.EventHandler(this.editProfileButton_Click_1);
            // 
            // transactionsBox
            // 
            this.transactionsBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.transactionsBox.Controls.Add(this.numOfTransaction);
            this.transactionsBox.Controls.Add(this.transactionTable);
            this.transactionsBox.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.transactionsBox.Location = new System.Drawing.Point(232, 4);
            this.transactionsBox.Name = "transactionsBox";
            this.transactionsBox.Size = new System.Drawing.Size(546, 263);
            this.transactionsBox.TabIndex = 1;
            this.transactionsBox.TabStop = false;
            this.transactionsBox.Text = "Transactions";
            this.transactionsBox.Enter += new System.EventHandler(this.customGroupBox_Enter);
            // 
            // numOfTransaction
            // 
            this.numOfTransaction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            this.numOfTransaction.ForeColor = System.Drawing.Color.Black;
            this.numOfTransaction.Location = new System.Drawing.Point(8, 244);
            this.numOfTransaction.Name = "numOfTransaction";
            this.numOfTransaction.Size = new System.Drawing.Size(96, 15);
            this.numOfTransaction.TabIndex = 5;
            this.numOfTransaction.Text = "0 Transaction(s)";
            // 
            // transactionTable
            // 
            this.transactionTable.AlternatingRowColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(237)))), ((int)(((byte)(245)))));
            this.transactionTable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.transactionTable.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(237)))), ((int)(((byte)(242)))), ((int)(((byte)(249)))));
            this.transactionTable.EnableToolTips = true;
            this.transactionTable.Font = new System.Drawing.Font("Tahoma", 8.25F);
            this.transactionTable.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(66)))), ((int)(((byte)(121)))));
            this.transactionTable.GridColor = System.Drawing.SystemColors.ControlDark;
            this.transactionTable.GridLines = XPTable.Models.GridLines.Both;
            this.transactionTable.GridLineStyle = XPTable.Models.GridLineStyle.Dot;
            this.transactionTable.HeaderFont = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold);
            this.transactionTable.Location = new System.Drawing.Point(8, 20);
            this.transactionTable.MultiSelect = true;
            this.transactionTable.Name = "transactionTable";
            this.transactionTable.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(169)))), ((int)(((byte)(183)))), ((int)(((byte)(201)))));
            this.transactionTable.SelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(66)))), ((int)(((byte)(121)))));
            this.transactionTable.SelectionStyle = XPTable.Models.SelectionStyle.Grid;
            this.transactionTable.Size = new System.Drawing.Size(528, 224);
            this.transactionTable.SortedColumnBackColor = System.Drawing.Color.Transparent;
            this.transactionTable.TabIndex = 4;
            this.transactionTable.UnfocusedSelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(201)))), ((int)(((byte)(210)))), ((int)(((byte)(221)))));
            this.transactionTable.UnfocusedSelectionForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(14)))), ((int)(((byte)(66)))), ((int)(((byte)(121)))));
            this.transactionTable.DoubleClick += new System.EventHandler(this.viewTxButton_Click);
            // 
            // customTaskItem1
            // 
            this.customTaskItem1.BackColor = System.Drawing.Color.Transparent;
            this.customTaskItem1.Image = null;
            this.customTaskItem1.Location = new System.Drawing.Point(0, 0);
            this.customTaskItem1.Name = "customTaskItem1";
            this.customTaskItem1.Size = new System.Drawing.Size(162, 16);
            this.customTaskItem1.TabIndex = 0;
            this.customTaskItem1.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.customTaskItem1.UseVisualStyleBackColor = false;
            // 
            // customTaskItem2
            // 
            this.customTaskItem2.BackColor = System.Drawing.Color.Transparent;
            this.customTaskItem2.Image = null;
            this.customTaskItem2.Location = new System.Drawing.Point(0, 0);
            this.customTaskItem2.Name = "customTaskItem2";
            this.customTaskItem2.Size = new System.Drawing.Size(162, 16);
            this.customTaskItem2.TabIndex = 0;
            this.customTaskItem2.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.customTaskItem2.UseVisualStyleBackColor = false;
            // 
            // customTaskItem3
            // 
            this.customTaskItem3.BackColor = System.Drawing.Color.Transparent;
            this.customTaskItem3.Image = null;
            this.customTaskItem3.Location = new System.Drawing.Point(0, 0);
            this.customTaskItem3.Name = "customTaskItem3";
            this.customTaskItem3.Size = new System.Drawing.Size(162, 16);
            this.customTaskItem3.TabIndex = 0;
            this.customTaskItem3.TextAlign = System.Drawing.ContentAlignment.TopLeft;
            this.customTaskItem3.UseVisualStyleBackColor = false;
            // 
            // customButton
            // 
            this.customButton.Location = new System.Drawing.Point(0, 0);
            this.customButton.Name = "customButton";
            this.customButton.Size = new System.Drawing.Size(75, 23);
            this.customButton.TabIndex = 0;
            // 
            // customTextBox
            // 
            this.customTextBox.Location = new System.Drawing.Point(0, 0);
            this.customTextBox.Name = "customTextBox";
            this.customTextBox.Size = new System.Drawing.Size(100, 20);
            this.customTextBox.TabIndex = 0;
            // 
            // customComboBox
            // 
            this.customComboBox.Location = new System.Drawing.Point(0, 0);
            this.customComboBox.Name = "customComboBox";
            this.customComboBox.Size = new System.Drawing.Size(121, 21);
            this.customComboBox.TabIndex = 0;
            // 
            // customCheckBox
            // 
            this.customCheckBox.Location = new System.Drawing.Point(0, 0);
            this.customCheckBox.Name = "customCheckBox";
            this.customCheckBox.Size = new System.Drawing.Size(104, 24);
            this.customCheckBox.TabIndex = 0;
            // 
            // customRadioButton
            // 
            this.customRadioButton.Location = new System.Drawing.Point(0, 0);
            this.customRadioButton.Name = "customRadioButton";
            this.customRadioButton.Size = new System.Drawing.Size(104, 24);
            this.customRadioButton.TabIndex = 0;
            // 
            // menubar
            // 
            this.menubar.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.fileMenu,
            this.viewMenu,
            this.menuItem4,
            this.menuItem1});
            // 
            // fileMenu
            // 
            this.fileMenu.Index = 0;
            this.fileMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.logoutMenuItem,
            this.exitMenuItem});
            this.fileMenu.Text = "&File";
            // 
            // logoutMenuItem
            // 
            this.logoutMenuItem.Enabled = false;
            this.logoutMenuItem.Index = 0;
            this.logoutMenuItem.Text = "Logout";
            this.logoutMenuItem.Click += new System.EventHandler(this.logoutMenuItem_Click);
            // 
            // exitMenuItem
            // 
            this.exitMenuItem.Index = 1;
            this.exitMenuItem.Text = "E&xit";
            this.exitMenuItem.Click += new System.EventHandler(this.exitMenuItem_Click);
            // 
            // viewMenu
            // 
            this.viewMenu.Index = 1;
            this.viewMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.animateMenuItem,
            this.themesMenuItem,
            this.cycleMenuItem,
            this.expandoDraggingMenuItem,
            this.separatorMenuItem1,
            this.showFocusMenuItem,
            this.separatorMenuItem2,
            this.myPicturesMenuItem,
            this.myComputerMenuItem,
            this.myNetworkMenuItem});
            this.viewMenu.Text = "&View";
            this.viewMenu.Visible = false;
            // 
            // animateMenuItem
            // 
            this.animateMenuItem.Index = 0;
            this.animateMenuItem.Text = "&Animate";
            this.animateMenuItem.Click += new System.EventHandler(this.animateMenuItem_Click);
            // 
            // themesMenuItem
            // 
            this.themesMenuItem.Index = 1;
            this.themesMenuItem.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.classicMenuItem,
            this.blueMenuItem,
            this.xboxMenuItem,
            this.itunesMenuItem,
            this.pantherMenuItem,
            this.bwMenuItem,
            this.defaultMenuItem});
            this.themesMenuItem.Text = "&Themes";
            // 
            // classicMenuItem
            // 
            this.classicMenuItem.Index = 0;
            this.classicMenuItem.Text = "&Classic";
            this.classicMenuItem.Click += new System.EventHandler(this.classicMenuItem_Click);
            // 
            // blueMenuItem
            // 
            this.blueMenuItem.Index = 1;
            this.blueMenuItem.Text = "C&ustom (Forever Blue)";
            this.blueMenuItem.Click += new System.EventHandler(this.blueMenuItem_Click);
            // 
            // xboxMenuItem
            // 
            this.xboxMenuItem.Index = 2;
            this.xboxMenuItem.Text = "Custom (&XBox)";
            this.xboxMenuItem.Click += new System.EventHandler(this.xboxMenuItem_Click);
            // 
            // itunesMenuItem
            // 
            this.itunesMenuItem.Index = 3;
            this.itunesMenuItem.Text = "Custom (&iTunes)";
            this.itunesMenuItem.Click += new System.EventHandler(this.itunesMenuItem_Click);
            // 
            // pantherMenuItem
            // 
            this.pantherMenuItem.Index = 4;
            this.pantherMenuItem.Text = "Custom (&Panther)";
            this.pantherMenuItem.Click += new System.EventHandler(this.pantherMenuItem_Click);
            // 
            // bwMenuItem
            // 
            this.bwMenuItem.Index = 5;
            this.bwMenuItem.Text = "Custom (&BW)";
            this.bwMenuItem.Click += new System.EventHandler(this.bwMenuItem_Click);
            // 
            // defaultMenuItem
            // 
            this.defaultMenuItem.Checked = true;
            this.defaultMenuItem.Index = 6;
            this.defaultMenuItem.Text = "&Default";
            this.defaultMenuItem.Click += new System.EventHandler(this.defaultMenuItem_Click);
            // 
            // cycleMenuItem
            // 
            this.cycleMenuItem.Index = 2;
            this.cycleMenuItem.Text = "C&ycle Expandos";
            this.cycleMenuItem.Click += new System.EventHandler(this.cycleMenuItem_Click);
            // 
            // expandoDraggingMenuItem
            // 
            this.expandoDraggingMenuItem.Index = 3;
            this.expandoDraggingMenuItem.Text = "Enable Expando &Dragging";
            this.expandoDraggingMenuItem.Click += new System.EventHandler(this.expandoDraggingMenuItem_Click);
            // 
            // separatorMenuItem1
            // 
            this.separatorMenuItem1.Index = 4;
            this.separatorMenuItem1.Text = "-";
            // 
            // showFocusMenuItem
            // 
            this.showFocusMenuItem.Index = 5;
            this.showFocusMenuItem.Text = "Show &Focus Cues";
            this.showFocusMenuItem.Click += new System.EventHandler(this.showFocusMenuItem_Click);
            // 
            // separatorMenuItem2
            // 
            this.separatorMenuItem2.Index = 6;
            this.separatorMenuItem2.Text = "-";
            // 
            // myPicturesMenuItem
            // 
            this.myPicturesMenuItem.Checked = true;
            this.myPicturesMenuItem.Index = 7;
            this.myPicturesMenuItem.Text = "Show My &Pictures";
            this.myPicturesMenuItem.Click += new System.EventHandler(this.myPicturesMenuItem_Click);
            // 
            // myComputerMenuItem
            // 
            this.myComputerMenuItem.Checked = true;
            this.myComputerMenuItem.Index = 8;
            this.myComputerMenuItem.Text = "Show My &Computer";
            this.myComputerMenuItem.Click += new System.EventHandler(this.myComputerMenuItem_Click);
            // 
            // myNetworkMenuItem
            // 
            this.myNetworkMenuItem.Checked = true;
            this.myNetworkMenuItem.Index = 9;
            this.myNetworkMenuItem.Text = "Show My &Network Places";
            this.myNetworkMenuItem.Click += new System.EventHandler(this.myNetworkMenuItem_Click);
            // 
            // menuItem4
            // 
            this.menuItem4.Index = 2;
            this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem5});
            this.menuItem4.Text = "Options";
            // 
            // menuItem5
            // 
            this.menuItem5.Index = 0;
            this.menuItem5.Text = "Mizaniya Configuration";
            this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
            // 
            // menuItem1
            // 
            this.menuItem1.Index = 3;
            this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            this.menuItem3,
            this.menuItem2});
            this.menuItem1.Text = "&Help";
            this.menuItem1.Visible = false;
            // 
            // menuItem3
            // 
            this.menuItem3.Index = 0;
            this.menuItem3.Text = "How to";
            // 
            // menuItem2
            // 
            this.menuItem2.Index = 1;
            this.menuItem2.Text = "About Mizaniya";
            // 
            // loginBox
            // 
            this.loginBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.loginBox.Controls.Add(this.rememberBox);
            this.loginBox.Controls.Add(this.newUserButton);
            this.loginBox.Controls.Add(this.loginButton);
            this.loginBox.Controls.Add(this.passwordBox);
            this.loginBox.Controls.Add(this.usernameBox);
            this.loginBox.Controls.Add(this.loginBoxPicture);
            this.loginBox.Location = new System.Drawing.Point(215, 4);
            this.loginBox.Name = "loginBox";
            this.loginBox.Size = new System.Drawing.Size(576, 550);
            this.loginBox.TabIndex = 4;
            this.loginBox.TabStop = false;
            // 
            // rememberBox
            // 
            this.rememberBox.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.rememberBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(102)))), ((int)(((byte)(153)))));
            this.rememberBox.ForeColor = System.Drawing.Color.White;
            this.rememberBox.Location = new System.Drawing.Point(358, 317);
            this.rememberBox.Name = "rememberBox";
            this.rememberBox.Size = new System.Drawing.Size(200, 19);
            this.rememberBox.TabIndex = 9;
            this.rememberBox.Text = "Save my username and password";
            this.rememberBox.UseVisualStyleBackColor = false;
            // 
            // newUserButton
            // 
            this.newUserButton.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.newUserButton.BackColor = System.Drawing.Color.CornflowerBlue;
            this.newUserButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.newUserButton.Font = new System.Drawing.Font("Arial", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.newUserButton.ForeColor = System.Drawing.Color.White;
            this.newUserButton.Location = new System.Drawing.Point(448, 278);
            this.newUserButton.Name = "newUserButton";
            this.newUserButton.Size = new System.Drawing.Size(88, 25);
            this.newUserButton.TabIndex = 8;
            this.newUserButton.Text = "New User";
            this.newUserButton.UseVisualStyleBackColor = false;
            this.newUserButton.Click += new System.EventHandler(this.newUserButton_Click);
            // 
            // loginButton
            // 
            this.loginButton.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.loginButton.BackColor = System.Drawing.Color.CornflowerBlue;
            this.loginButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.loginButton.Font = new System.Drawing.Font("Arial", 7.8F);
            this.loginButton.ForeColor = System.Drawing.Color.White;
            this.loginButton.Location = new System.Drawing.Point(358, 278);
            this.loginButton.Name = "loginButton";
            this.loginButton.Size = new System.Drawing.Size(87, 25);
            this.loginButton.TabIndex = 7;
            this.loginButton.Text = "Log In";
            this.loginButton.UseVisualStyleBackColor = false;
            this.loginButton.Click += new System.EventHandler(this.loginButton_Click);
            // 
            // passwordBox
            // 
            this.passwordBox.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.passwordBox.Location = new System.Drawing.Point(358, 241);
            this.passwordBox.Name = "passwordBox";
            this.passwordBox.PasswordChar = '*';
            this.passwordBox.Size = new System.Drawing.Size(180, 21);
            this.passwordBox.TabIndex = 6;
            this.passwordBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.Enter_KeyUp);
            // 
            // usernameBox
            // 
            this.usernameBox.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.usernameBox.Location = new System.Drawing.Point(358, 218);
            this.usernameBox.Name = "usernameBox";
            this.usernameBox.Size = new System.Drawing.Size(180, 21);
            this.usernameBox.TabIndex = 5;
            // 
            // loginBoxPicture
            // 
            this.loginBoxPicture.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.loginBoxPicture.BackColor = System.Drawing.Color.White;
            this.loginBoxPicture.Image = ((System.Drawing.Image)(resources.GetObject("loginBoxPicture.Image")));
            this.loginBoxPicture.Location = new System.Drawing.Point(13, 138);
            this.loginBoxPicture.Name = "loginBoxPicture";
            this.loginBoxPicture.Size = new System.Drawing.Size(550, 338);
            this.loginBoxPicture.TabIndex = 5;
            this.loginBoxPicture.TabStop = false;
            // 
            // addButton
            // 
            this.addButton.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(196)))), ((int)(((byte)(200)))), ((int)(((byte)(212)))));
            this.addButton.DefaultScheme = true;
            this.addButton.DialogResult = System.Windows.Forms.DialogResult.None;
            this.addButton.Hint = "";
            this.addButton.Location = new System.Drawing.Point(37, 168);
            this.addButton.Name = "addButton";
            this.addButton.Scheme = PinkieControls.ButtonXP.Schemes.Silver;
            this.addButton.Size = new System.Drawing.Size(104, 24);
            this.addButton.TabIndex = 19;
            this.addButton.Text = "Add";
            // 
            // tabControl1
            // 
            this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Controls.Add(this.tabPage3);
            this.tabControl1.Controls.Add(this.tabSharedTxSummary);
            this.tabControl1.Location = new System.Drawing.Point(232, 264);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new System.Drawing.Size(544, 280);
            this.tabControl1.TabIndex = 11;
            // 
            // tabPage1
            // 
            this.tabPage1.Controls.Add(this.zedGraphControl1);
            this.tabPage1.Location = new System.Drawing.Point(4, 22);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Size = new System.Drawing.Size(536, 254);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "Monthly Graph";
            this.tabPage1.UseVisualStyleBackColor = true;
            // 
            // zedGraphControl1
            // 
            this.zedGraphControl1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.zedGraphControl1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.zedGraphControl1.IsAutoScrollRange = false;
            this.zedGraphControl1.IsEnableHPan = true;
            this.zedGraphControl1.IsEnableHZoom = true;
            this.zedGraphControl1.IsEnableVPan = true;
            this.zedGraphControl1.IsEnableVZoom = true;
            this.zedGraphControl1.IsScrollY2 = false;
            this.zedGraphControl1.IsShowContextMenu = true;
            this.zedGraphControl1.IsShowCursorValues = false;
            this.zedGraphControl1.IsShowHScrollBar = false;
            this.zedGraphControl1.IsShowPointValues = false;
            this.zedGraphControl1.IsShowVScrollBar = false;
            this.zedGraphControl1.IsZoomOnMouseCenter = false;
            this.zedGraphControl1.Location = new System.Drawing.Point(0, 3);
            this.zedGraphControl1.Name = "zedGraphControl1";
            this.zedGraphControl1.PanButtons = System.Windows.Forms.MouseButtons.Left;
            this.zedGraphControl1.PanButtons2 = System.Windows.Forms.MouseButtons.Middle;
            this.zedGraphControl1.PanModifierKeys2 = System.Windows.Forms.Keys.None;
            this.zedGraphControl1.PointDateFormat = "g";
            this.zedGraphControl1.PointValueFormat = "G";
            this.zedGraphControl1.ScrollMaxX = 0;
            this.zedGraphControl1.ScrollMaxY = 0;
            this.zedGraphControl1.ScrollMaxY2 = 0;
            this.zedGraphControl1.ScrollMinX = 0;
            this.zedGraphControl1.ScrollMinY = 0;
            this.zedGraphControl1.ScrollMinY2 = 0;
            this.zedGraphControl1.Size = new System.Drawing.Size(534, 248);
            this.zedGraphControl1.TabIndex = 1;
            this.zedGraphControl1.ZoomButtons = System.Windows.Forms.MouseButtons.Left;
            this.zedGraphControl1.ZoomButtons2 = System.Windows.Forms.MouseButtons.None;
            this.zedGraphControl1.ZoomModifierKeys = System.Windows.Forms.Keys.None;
            this.zedGraphControl1.ZoomModifierKeys2 = System.Windows.Forms.Keys.None;
            this.zedGraphControl1.ZoomStepFraction = 0.1;
            // 
            // tabPage3
            // 
            this.tabPage3.Controls.Add(this.accountSummaryBox);
            this.tabPage3.Location = new System.Drawing.Point(4, 22);
            this.tabPage3.Name = "tabPage3";
            this.tabPage3.Size = new System.Drawing.Size(536, 254);
            this.tabPage3.TabIndex = 2;
            this.tabPage3.Text = "Account Summaries";
            this.tabPage3.UseVisualStyleBackColor = true;
            this.tabPage3.Visible = false;
            // 
            // accountSummaryBox
            // 
            this.accountSummaryBox.BackColor = System.Drawing.Color.AliceBlue;
            this.accountSummaryBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.accountSummaryBox.Location = new System.Drawing.Point(8, 3);
            this.accountSummaryBox.Name = "accountSummaryBox";
            this.accountSummaryBox.Size = new System.Drawing.Size(256, 249);
            this.accountSummaryBox.TabIndex = 2;
            // 
            // tabSharedTxSummary
            // 
            this.tabSharedTxSummary.Controls.Add(this.sharedBillsText);
            this.tabSharedTxSummary.Location = new System.Drawing.Point(4, 22);
            this.tabSharedTxSummary.Name = "tabSharedTxSummary";
            this.tabSharedTxSummary.Size = new System.Drawing.Size(536, 254);
            this.tabSharedTxSummary.TabIndex = 3;
            this.tabSharedTxSummary.Text = "Shared Bills Summary";
            this.tabSharedTxSummary.UseVisualStyleBackColor = true;
            this.tabSharedTxSummary.Enter += new System.EventHandler(this.tabSharedTxSummary_Enter);
            // 
            // sharedBillsText
            // 
            this.sharedBillsText.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.sharedBillsText.Dock = System.Windows.Forms.DockStyle.Fill;
            this.sharedBillsText.Location = new System.Drawing.Point(0, 0);
            this.sharedBillsText.Multiline = true;
            this.sharedBillsText.Name = "sharedBillsText";
            this.sharedBillsText.ReadOnly = true;
            this.sharedBillsText.Size = new System.Drawing.Size(536, 254);
            this.sharedBillsText.TabIndex = 0;
            this.sharedBillsText.Text = "All your depts and loans with other users have been settled.";
            // 
            // SystemView
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
            this.BackColor = System.Drawing.SystemColors.Window;
            this.ClientSize = new System.Drawing.Size(792, 569);
            this.Controls.Add(this.tabControl1);
            this.Controls.Add(this.transactionsBox);
            this.Controls.Add(this.systemTaskPane);
            this.Controls.Add(this.loginBox);
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Menu = this.menubar;
            this.MinimumSize = new System.Drawing.Size(800, 600);
            this.Name = "SystemView";
            this.Text = "Mizaniya Budget Planner";
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            ((System.ComponentModel.ISupportInitialize)(this.systemTaskPane)).EndInit();
            this.systemTaskPane.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.transactionTasks)).EndInit();
            this.transactionTasks.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.accountTasks)).EndInit();
            this.accountTasks.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.toolsTasks)).EndInit();
            this.toolsTasks.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.profileTask)).EndInit();
            this.profileTask.ResumeLayout(false);
            this.transactionsBox.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.transactionTable)).EndInit();
            this.loginBox.ResumeLayout(false);
            this.loginBox.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.loginBoxPicture)).EndInit();
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            this.tabPage3.ResumeLayout(false);
            this.tabSharedTxSummary.ResumeLayout(false);
            this.tabSharedTxSummary.PerformLayout();
            this.ResumeLayout(false);

		}


		/// <summary>
		/// 
		/// </summary>
		private void InitialiseDescriptors()
		{
			//			this.customTaskPaneDescriptor = new TaskPaneDescriptor(this.customTaskPane);
			//			this.customExpandoDescriptor = new ExpandoDescriptor(this.customExpando);
			this.customTaskItem1Descriptor = new TaskItemDescriptor(this.customTaskItem1);
			this.customTaskItem2Descriptor = new TaskItemDescriptor(this.customTaskItem2);
			this.customTaskItem3Descriptor = new TaskItemDescriptor(this.customTaskItem3);
		}

		#endregion


		#region Methods

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}

			base.Dispose(disposing);
		}


		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		//		[STAThread]
		//		static void Main() 
		//		{
		//			Application.Run(new DemoForm());
		//		}

		#endregion


		#region Events

		#region Menu
		
		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void exitMenuItem_Click(object sender, System.EventArgs e)
		{
			MizClient.MizClient.Exit();
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void animateMenuItem_Click(object sender, System.EventArgs e)
		{
			this.animateMenuItem.Checked = !this.animateMenuItem.Checked;

			this.transactionTasks.Animate = this.animateMenuItem.Checked;
			this.accountTasks.Animate = this.animateMenuItem.Checked;
			this.toolsTasks.Animate = this.animateMenuItem.Checked;
			this.profileTask.Animate = this.animateMenuItem.Checked;
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void cycleMenuItem_Click(object sender, System.EventArgs e)
		{
			this.systemTaskPane.Expandos.MoveToBottom(this.systemTaskPane.Expandos[0]);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void expandoDraggingMenuItem_Click(object sender, System.EventArgs e)
		{
			this.expandoDraggingMenuItem.Checked = !this.expandoDraggingMenuItem.Checked;

			this.systemTaskPane.AllowExpandoDragging = this.expandoDraggingMenuItem.Checked;
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void classicMenuItem_Click(object sender, System.EventArgs e)
		{
			this.classicMenuItem.Checked = true;
			this.blueMenuItem.Checked = false;
			this.itunesMenuItem.Checked = false;
			this.pantherMenuItem.Checked = false;
			this.bwMenuItem.Checked = false;
			this.xboxMenuItem.Checked = false;
			this.defaultMenuItem.Checked = false;

			this.systemTaskPane.UseClassicTheme();
			//this.customTaskPane.UseClassicTheme();
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void blueMenuItem_Click(object sender, System.EventArgs e)
		{
			this.classicMenuItem.Checked = false;
			this.blueMenuItem.Checked = true;
			this.itunesMenuItem.Checked = false;
			this.pantherMenuItem.Checked = false;
			this.bwMenuItem.Checked = false;
			this.xboxMenuItem.Checked = false;
			this.defaultMenuItem.Checked = false;

			// foreverblue.dll is a cut down version of the the 
			// forever blue theme. do not attempt to use this as 
			// a proper theme for XP as Windows may crash due to 
			// several images being removed from the dll to keep
			// file sizes down.  the original forever blue theme 
			// can be found at http://www.themexp.org/
			this.systemTaskPane.UseCustomTheme("foreverblue.dll");
			//this.customTaskPane.UseCustomTheme("foreverblue.dll");
		}

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void itunesMenuItem_Click(object sender, System.EventArgs e)
		{
			this.classicMenuItem.Checked = false;
			this.blueMenuItem.Checked = false;
			this.itunesMenuItem.Checked = true;
			this.pantherMenuItem.Checked = false;
			this.bwMenuItem.Checked = false;
			this.xboxMenuItem.Checked = false;
			this.defaultMenuItem.Checked = false;

			// itunes.dll is a cut down version of the the 
			// iTunes theme. do not attempt to use this as 
			// a proper theme for XP as Windows may crash due to 
			// several images being removed from the dll to keep
			// file sizes down.  the original iTunes theme 
			// can be found at http://www.themexp.org/
			this.systemTaskPane.UseCustomTheme("itunes.dll");
			//this.customTaskPane.UseCustomTheme("itunes.dll");
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void pantherMenuItem_Click(object sender, System.EventArgs e)
		{
			this.classicMenuItem.Checked = false;
			this.blueMenuItem.Checked = false;
			this.itunesMenuItem.Checked = false;
			this.pantherMenuItem.Checked = true;
			this.bwMenuItem.Checked = false;
			this.xboxMenuItem.Checked = false;
			this.defaultMenuItem.Checked = false;

			// panther.dll is a cut down version of the the 
			// OS X Panther theme. do not attempt to use this as 
			// a proper theme for XP as Windows may crash due to 
			// several images being removed from the dll to keep
			// file sizes down.  the original OS X Panther theme 
			// can be found at http://www.themexp.org/
			this.systemTaskPane.UseCustomTheme("panther.dll");
			//this.customTaskPane.UseCustomTheme("panther.dll");
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void bwMenuItem_Click(object sender, System.EventArgs e)
		{
			this.classicMenuItem.Checked = false;
			this.blueMenuItem.Checked = false;
			this.itunesMenuItem.Checked = false;
			this.pantherMenuItem.Checked = false;
			this.bwMenuItem.Checked = true;
			this.xboxMenuItem.Checked = false;
			this.defaultMenuItem.Checked = false;

			this.systemTaskPane.UseCustomTheme("bw.dll");
			//this.customTaskPane.UseCustomTheme("bw.dll");
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void xboxMenuItem_Click(object sender, System.EventArgs e)
		{
			this.classicMenuItem.Checked = false;
			this.blueMenuItem.Checked = false;
			this.itunesMenuItem.Checked = false;
			this.pantherMenuItem.Checked = false;
			this.bwMenuItem.Checked = false;
			this.xboxMenuItem.Checked = true;
			this.defaultMenuItem.Checked = false;

			// xbox.dll is a cut down version of the the 
			// XtremeXP theme. do not attempt to use this as 
			// a proper theme for XP as Windows may crash due to 
			// several images being removed from the dll to keep
			// file sizes down.  the original XtremeXP theme 
			// can be found at http://www.themexp.org/
			this.systemTaskPane.UseCustomTheme("xbox.dll");
			//this.customTaskPane.UseCustomTheme("xbox.dll");
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void defaultMenuItem_Click(object sender, System.EventArgs e)
		{
			this.classicMenuItem.Checked = false;
			this.blueMenuItem.Checked = false;
			this.itunesMenuItem.Checked = false;
			this.pantherMenuItem.Checked = false;
			this.bwMenuItem.Checked = false;
			this.xboxMenuItem.Checked = false;
			this.defaultMenuItem.Checked = true;

			this.systemTaskPane.UseDefaultTheme();
			//this.customTaskPane.UseDefaultTheme();
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void myPicturesMenuItem_Click(object sender, System.EventArgs e)
		{
			if (this.toolsTasks.Collapsed)
			{
				return;
			}
			
			this.myPicturesMenuItem.Checked = !this.myPicturesMenuItem.Checked;
			
			if (!this.myPicturesMenuItem.Checked)
			{
				this.toolsTasks.HideControl(this.loansButton);
			}
			else
			{
				this.toolsTasks.ShowControl(this.loansButton);
			}
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void myComputerMenuItem_Click(object sender, System.EventArgs e)
		{
			if (this.toolsTasks.Collapsed)
			{
				return;
			}
			
			this.myComputerMenuItem.Checked = !this.myComputerMenuItem.Checked;
			
			if (!this.myComputerMenuItem.Checked)
			{
				this.toolsTasks.HideControl(this.recurringPaymentButton);
			}
			else
			{
				this.toolsTasks.ShowControl(this.recurringPaymentButton);
			}
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void myNetworkMenuItem_Click(object sender, System.EventArgs e)
		{
			if (this.toolsTasks.Collapsed)
			{
				return;
			}
			
			this.myNetworkMenuItem.Checked = !this.myNetworkMenuItem.Checked;
			
			if (!this.myNetworkMenuItem.Checked)
			{
				this.toolsTasks.HideControl(this.myNetworkPlacesTaskItem);
			}
			else
			{
				this.toolsTasks.ShowControl(this.myNetworkPlacesTaskItem);
			}
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void showFocusMenuItem_Click(object sender, System.EventArgs e)
		{
			this.showFocusMenuItem.Checked = !this.showFocusMenuItem.Checked;
			bool showFocus = this.showFocusMenuItem.Checked;

			this.transactionTasks.ShowFocusCues = showFocus;
			this.addNewTxButton.ShowFocusCues = showFocus;
			this.searchTxButton.ShowFocusCues = showFocus;
			this.printPicturesTaskItem.ShowFocusCues = showFocus;
			this.copyToCDTaskItem.ShowFocusCues = showFocus;

			this.accountTasks.ShowFocusCues = showFocus;
			this.addAccountButton.ShowFocusCues = showFocus;
			this.editAccountButton.ShowFocusCues = showFocus;
			this.deleteAccountButton.ShowFocusCues = showFocus;

			this.toolsTasks.ShowFocusCues = showFocus;
			this.monthlySummaryButton.ShowFocusCues = showFocus;
			this.loansButton.ShowFocusCues = showFocus;
			this.recurringPaymentButton.ShowFocusCues = showFocus;
			this.myNetworkPlacesTaskItem.ShowFocusCues = showFocus;

			this.profileTask.ShowFocusCues = showFocus;
		}

		#endregion


		#region Serialization

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void serializeFileButton_Click(object sender, System.EventArgs e)
		{
			IFormatter formatter = new BinaryFormatter();
			
			Stream stream = null;
			
			try
			{
				stream = new FileStream("Serialized XPExplorerBar.txt", FileMode.Create, FileAccess.Write, FileShare.None);
				
				TaskPane.TaskPaneSurrogate serializeTaskPaneSurrogate = new TaskPane.TaskPaneSurrogate(); 
				//serializeTaskPaneSurrogate.Load(this.serializeTaskPane);
				
				formatter.Serialize(stream, serializeTaskPaneSurrogate);

				MessageBox.Show(this, 
					"XPExplorerBar successfully serialized to '" + Application.StartupPath + "\\Serialized XPExplorerBar.txt'", 
					"XPExplorerBar Serialized", 
					MessageBoxButtons.OK, 
					MessageBoxIcon.Information);
			}
			catch (ArgumentNullException ane)
			{
				MessageBox.Show(this, ane.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (SerializationException se)
			{
				MessageBox.Show(this, se.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (SecurityException sece)
			{
				MessageBox.Show(this, sece.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (IOException ioe)
			{
				MessageBox.Show(this, ioe.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			finally
			{
				if (stream != null)
				{
					stream.Close();
				}
			}
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void deserializeFileButton_Click(object sender, System.EventArgs e)
		{
			//			if (this.serializeGroupBox.Controls.Count == 8)
			//			{
			//				MessageBox.Show(this, 
			//					"XPExplorerBar cannot be deserialized as there is an existing deserialized XPExplorerBar.\r\nPlease remove the existing deserialized XPExplorerBar first by using the 'Remove' button", 
			//					"Cannot Deserialize", 
			//					MessageBoxButtons.OK, 
			//					MessageBoxIcon.Exclamation);
			//				
			//				return;
			//			}
			
			IFormatter formatter = new BinaryFormatter();
			
			Stream stream = null;
			
			try
			{
				stream = new FileStream("Serialized XPExplorerBar.txt", FileMode.Open, FileAccess.Read, FileShare.Read);
			
				TaskPane.TaskPaneSurrogate serializeTaskPaneSurrogate = (TaskPane.TaskPaneSurrogate) formatter.Deserialize(stream);  

				TaskPane taskpane = serializeTaskPaneSurrogate.Save();
				taskpane.Name = "SerializedTaskPane";
				taskpane.Location = new Point(8, 350);
				
				//this.serializeGroupBox.Controls.Add(taskpane);
			}
			catch (System.Reflection.TargetInvocationException tie)
			{
				MessageBox.Show(this, tie.InnerException.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (ArgumentNullException ane)
			{
				MessageBox.Show(this, ane.Message, "Error" + ane.ParamName, MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (SerializationException se)
			{
				MessageBox.Show(this, se.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (SecurityException sece)
			{
				MessageBox.Show(this, sece.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (IOException ioe)
			{
				MessageBox.Show(this, ioe.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			finally
			{
				if (stream != null)
				{
					stream.Close();
				}
			}
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void serializeMemoryButton_Click(object sender, System.EventArgs e)
		{

			MemoryStream stream1 = null;
			MemoryStream stream2 = null;
			
			try
			{
				stream1 = new MemoryStream();
				
				IFormatter formatter = new BinaryFormatter();
				
				//formatter.Serialize(stream1, this.serializeTaskPane);

				TaskPane.TaskPaneSurrogate serializeTaskPaneSurrogate = new TaskPane.TaskPaneSurrogate(); 
				//serializeTaskPaneSurrogate.Load(this.serializeTaskPane);
				
				formatter.Serialize(stream1, serializeTaskPaneSurrogate);

				byte[] bytes = stream1.ToArray();

				stream1.Flush();
				stream1.Close();
				stream1 = null;

				stream2 = new MemoryStream(bytes);
				stream2.Position = 0;

				//TaskPane taskpane = (TaskPane) formatter.Deserialize(stream2);
				TaskPane.TaskPaneSurrogate deserializeTaskPaneSurrogate = (TaskPane.TaskPaneSurrogate) formatter.Deserialize(stream2);  

				stream2.Close();
				stream2 = null;

				TaskPane taskpane = deserializeTaskPaneSurrogate.Save();
				taskpane.Name = "SerializedTaskPane";
				taskpane.Location = new Point(8, 350);
				
				//this.serializeGroupBox.Controls.Add(taskpane);
			}
			catch (ArgumentNullException ane)
			{
				MessageBox.Show(this, ane.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (SerializationException se)
			{
				MessageBox.Show(this, se.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (SecurityException sece)
			{
				MessageBox.Show(this, sece.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			catch (IOException ioe)
			{
				MessageBox.Show(this, ioe.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			finally
			{
				if (stream1 != null)
				{
					stream1.Close();
				}

				if (stream2 != null)
				{
					stream2.Close();
				}
			}
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void removeButton_Click(object sender, System.EventArgs e)
		{

		}

		#endregion



		#endregion

		private void customGroupBox_Enter(object sender, System.EventArgs e)
		{
		
		}

		private void loginButton_Click(object sender, System.EventArgs e)
		{
            try
            {
                manager.Login(usernameBox.Text, passwordBox.Text);
                if (rememberBox.Checked)
                {
                    MizClient.MizClient.RememberUserCredentials(manager.CurrentUserID);
                }
                else
                    MizClient.MizClient.ForgetUserCredentials();

                login();
            }
            catch (MizExceptions.InvalidUserCredentialsException exp)
            {
                MessageBox.Show("Wrong username and password entered.", "Login access", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            catch (MizExceptions.ServerUnavailableException e2)
            {
                return;
            }
		}

        /// <summary>
        /// Set up UI state upon login
        /// </summary>
		private void login()
		{
			this.userNameLabel.Text = manager.CurrentUserID.Name;
			this.lastLoggedLabel.Text = manager.getUserLastLoggedInTime();
			this.transactionsBox.Visible = true;
			this.accountSummaryBox.Visible = true;
			this.tabControl1.Visible = true;

			this.loginBox.Visible = false;
			this.loginBoxPicture.Visible = false;
			this.usernameBox.Visible = false;
			this.passwordBox.Visible = false;
			this.loginButton.Visible = false;
			this.newUserButton.Visible = false;

			this.systemTaskPane.Enabled = true;
			this.logoutMenuItem.Enabled = true;
				
			//if(flag==1)
				//UpdateGraph(zedGraphControl1);
			//else
			    CreateGraph(zedGraphControl1);
			
			refreshTransactionTable();
			refreshAccountTable();

            // system should start with the revenue expenditure graph
            tabControl1.SelectedTab = tabPage1;

		}

		protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);

			// get the sample images resource
			System.Reflection.Assembly myAssembly;
			myAssembly = this.GetType().Assembly;
			myManager = new ResourceManager("MizClient.Images", myAssembly);

			this.transactionTable.BeginUpdate();


			ImageColumn imageColumn = new ImageColumn("", 20);
			imageColumn.DrawText = true;

			TextColumn subjectColumn = new TextColumn();
			subjectColumn.Text = "Subject";
			subjectColumn.Editable = false;
			subjectColumn.ToolTipText = "The transaction's subject";
			subjectColumn.Width = 115;

			

			TextColumn dateColumn = new TextColumn();
			dateColumn.Text = "Date";
			dateColumn.Editable = false;
			dateColumn.ToolTipText = "The date the transaction was done";
			dateColumn.Width = 115;

			NumberColumn amountColumn = new NumberColumn();
			amountColumn.Editable = false;
			amountColumn.Text = "Amount (CA$)";
			amountColumn.ToolTipText = "The amount involved in this transaction";
			amountColumn.Width = 100;

			TextColumn typeColumn = new TextColumn();
			typeColumn.Editable = false;
			typeColumn.Text = "Type";
			typeColumn.ToolTipText = "The transaction's type";
			typeColumn.Visible = true;
			typeColumn.Width = 100 ;

			TextColumn accountColumn = new TextColumn();
			accountColumn.Editable = false;
			accountColumn.Text = "Account";
			accountColumn.ToolTipText = "The account involved in the transaction";
			accountColumn.Width = 100;

			TextColumn descriptionColumn = new TextColumn();
			descriptionColumn.Editable = false;
			descriptionColumn.Text = "Description";
			descriptionColumn.ToolTipText = "The transaction's description";
			descriptionColumn.Width = 225;

			TextColumn idColumn = new TextColumn();
			idColumn.Editable = false;
			idColumn.Visible = false;
			idColumn.Text = "";
			idColumn.ToolTipText = "";
			idColumn.Width = 0;


			this.transactionTable.ColumnModel = new ColumnModel(new Column[] {
																				 imageColumn,
																				 subjectColumn,
																				 dateColumn,
																				 amountColumn,
																				 typeColumn,
																				 accountColumn,
																				 descriptionColumn,
																				 idColumn
																			 });
																				
			this.transactionTable.TableModel = new TableModel(new Row[] 
														  {											});

			this.transactionTable.HeaderRenderer = new XPTable.Renderers.GradientHeaderRenderer();
			this.transactionTable.TableModel.RowHeight += 3;
			this.transactionTable.FullRowSelect = true;

			this.transactionTable.EndUpdate();
		
		}

		private void addNewTxButton_Click(object sender, System.EventArgs e)
		{
				View.TransactionView transactionForm = new View.TransactionView(manager) ;
				transactionForm.ShowDialog();
			    refreshAccountTable();
		}

		private void viewTxButton_Click(object sender, System.EventArgs e)
		{
			int index;
			Model.Transaction tx;
			if(transactionTable.SelectedIndicies.Length != 0)
			{
				index = transactionTable.SelectedIndicies[0];
				string id;
				//Make sure the index i.e 7 represent the last column of the table
				id = transactionTable.TableModel.Rows[index].Cells[7].Text;
			
				tx = manager.GetTransactionFromID(Convert.ToUInt32(id));

				View.TransactionView transactionForm = new View.TransactionView(manager, tx) ;
				transactionForm.ShowDialog();
			}
		}

		private void newUserButton_Click(object sender, System.EventArgs e)
		{
			View.NewUser newUserForm = new View.NewUser(manager) ;
			newUserForm.ShowDialog();
		}

		private void logoutMenuItem_Click(object sender, System.EventArgs e)
		{
            Logout();
		}

        /// <summary>
        /// Hides all UI that should not be seen when logged out.
        /// Brings the view to login dialog
        /// </summary>
        /// <remarks>This method should never make a call to the server,
        /// as this is called during server diconnects</remarks>
        public void Logout()
        {
            this.transactionsBox.Visible = false;
            transactionTable.TableModel.Rows.Clear();
            flag = 1;

            this.accountSummaryBox.Visible = false;
            this.systemTaskPane.Enabled = false;
            this.logoutMenuItem.Enabled = false;
            this.tabControl1.Visible = false;

            this.loginBox.Visible = true;
            this.loginBoxPicture.Visible = true;

            if (MizClient.MizClient.isUserCredentialsRemembered())
            {
                usernameBox.Text = MizClient.MizClient.RememberedUserName;
                passwordBox.Text = MizClient.MizClient.RememberedUserPassword;
                rememberBox.Checked = true;
            }
            else
            {
                usernameBox.Clear();
                passwordBox.Clear();
                rememberBox.Checked = false;
            }


            this.usernameBox.Visible = true;
            this.passwordBox.Visible = true;
            this.loginButton.Visible = true;
            this.newUserButton.Visible = true;
            this.userNameLabel.Text = "";
            this.lastLoggedLabel.Text = "";
        }

		private void refreshTransactionTable()
		{
			
			int totalRow = manager.TransactionList.Count;
			Model.Transaction tx = new Model.Transaction();

			transactionTable.TableModel.Rows.Clear();
 
			for (int i = 0; i<totalRow; i++)
			{
				tx = (Model.Transaction) manager.TransactionList[i];
				transactionTable.TableModel.Rows.Insert(0, new Row(new Cell[] {
																				  new Cell("", (Image) myManager.GetObject((tx.IsNotify? "STAR":"s"))),
																				 	new Cell(tx.Subject),
																					new Cell(tx.Date.ToShortDateString()),
																					new Cell(tx.getTotalAmount()),
																					new Cell(tx.Type),
																				new Cell(tx.SourceExternalAccount),
																				new Cell(tx.CategoryDescription),
										new Cell(tx.TransactionID.ToString())

																			}));

			}
			numOfTransaction.Text = totalRow.ToString()+" Transactions(s)";

			//Refresh graph
		    CreateGraph(zedGraphControl1);
		}

		private void addAccountButton_Click(object sender, System.EventArgs e)
		{
			View.AddAccountDialog AddAcountForm = new View.AddAccountDialog(manager) ;
			AddAcountForm.ShowDialog();
			refreshAccountTable();
		}

		private void editProfileButton_Click_1(object sender, System.EventArgs e)
		{
			View.EditUserProfile EditUserForm = new View.EditUserProfile(manager);
			EditUserForm.ShowDialog();
		}


		private void button1_Click_1(object sender, System.EventArgs e)
		{
			refreshTransactionTable();
		}

		private void refreshAccountTable()
		{
			this.accountSummaryBox.Items.Clear();
			string[] str = new string[manager.ExternalAccountList.Count];
			for(int i = 0; i< manager.ExternalAccountList.Count; i++)
			{
				Model.ExternalAccount account = ((Model.ExternalAccount)manager.ExternalAccountList[i]);
				str[i] = account.AccountName +"\t"+account.Balance.ToString()+" $";
			}
			this.accountSummaryBox.Items.AddRange(str);
		}

		private void Enter_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			// If enter is pressed
			if (e.KeyCode == Keys.Enter)
			{
				try
				{
					manager.Login(usernameBox.Text, passwordBox.Text);
					this.userNameLabel.Text = manager.CurrentUserID.Name;
					this.transactionsBox.Visible = true;
					this.accountSummaryBox.Visible = true;
					this.tabControl1.Visible = true;

					this.loginBox.Visible = false;
					this.loginBoxPicture.Visible = false;
					this.usernameBox.Visible = false;
					this.passwordBox.Visible = false;
					this.loginButton.Visible = false;
					this.newUserButton.Visible = false;

					this.systemTaskPane.Enabled = true;
					this.logoutMenuItem.Enabled = true;
				
					//if(flag==1)
						//UpdateGraph(zedGraphControl1);
					//else
						CreateGraph(zedGraphControl1);
			
					refreshTransactionTable();
					refreshAccountTable();
				}
				catch(Exception exp)
				{
					MessageBox.Show("Wrong username and password entered.","Login access",MessageBoxButtons.OK,MessageBoxIcon.Hand);
				}
			}
		}

        private void updateTransaction(object sender, MizEventArgs.ActionTransactionUpdate ev)
        {
            this.refreshAccountTable();
            this.refreshTransactionTable();
            if (tabControl1.SelectedTab.Equals(tabSharedTxSummary))
            {
                refreshSharedTxSummary();
            }
        }

		private void CreateGraph( ZedGraphControl zg1 )
		{
			//if(flag == 1)
			zg1.GraphPane.CurveList.Clear();
			// get a reference to the GraphPane
			GraphPane myPane = zg1.GraphPane;
   
			// Set the Titles
			myPane.Title = "Monthly Revenues and Expenses";
			myPane.XAxis.Title = DateTime.Now.ToString("MMMM");
			myPane.YAxis.Title = "CA $";
   
			// Make up some random data points
			Model.ExpRevPair[] monthlyReport = manager.GenerateExpRevReport(new DateTime(DateTime.Now.Year,DateTime.Now.Month,1));
			string[] labels = new string[monthlyReport.Length];// = { "January","February","March","April","May","June","July","August","September","October","November","December"};
			double[] expenses= new double[monthlyReport.Length] ;//= { 114,234,23,27,443,67,253,67,203,167,53,97};
			double[] revenues= new double[monthlyReport.Length] ;//= { 235,99,12,131,12,111,12,191,552,11,12,11};
			for (int i=0;i<monthlyReport.Length;i++)
			{
				//if (i%30 == 0)
					labels[i]=((int) i+1).ToString();
				expenses[i]=(double)monthlyReport[i].expense;
				revenues[i]=(double)monthlyReport[i].revenue;
			}

			LineItem myCurve = myPane.AddCurve("Expenses",null,expenses,Color.Red);
			myCurve.Symbol.Size = 8.0F;
			myCurve.Symbol.Fill = new Fill( Color.White);
			myCurve.Line.Width = 2.0F;

			myCurve = myPane.AddCurve("Revenues",null,revenues,Color.Green);
			myCurve.Symbol.Size = 8.0F;
			myCurve.Symbol.Fill = new Fill( Color.White);
			myCurve.Line.Width = 2.0F;
   
			// Draw the X tics between the labels instead of 
			// at the labels
			myPane.XAxis.IsTicsBetweenLabels = false;
   
			// Set the XAxis to Text type
			myPane.XAxis.Type = AxisType.Text;
			// Set the XAxis labels
			myPane.XAxis.TextLabels = labels;
   
			// Fill the Axis and Pane backgrounds
			myPane.AxisFill = new Fill( Color.White,
				Color.FromArgb( 255, 255, 166), 90F );
			myPane.PaneFill = new Fill( Color.FromArgb( 250, 250, 255) );
   
			// Tell ZedGraph to refigure the
			// axes since the data have changed
			zg1.AxisChange();
		}

//		private void UpdateGraph( ZedGraphControl zg1 )
//		{
//			// get a reference to the GraphPane
//			zg1.GraphPane.CurveList.Clear();
//			GraphPane myPane = zg1.GraphPane;
//			
//			// Set the Titles
//			myPane.Title = "Monthly Revenues and Expenses";
//			myPane.XAxis.Title = DateTime.Now.ToString("MMMM");
//			myPane.YAxis.Title = "CA $";
//   
//			// Make up some random data points
//			Model.ExpRevPair[] monthlyReport = manager.GenerateExpRevReport(new DateTime(DateTime.Now.Year,DateTime.Now.Month,1));
//			string[] labels = new string[monthlyReport.Length];// = { "January","February","March","April","May","June","July","August","September","October","November","December"};
//			double[] expenses= new double[monthlyReport.Length] ;//= { 114,234,23,27,443,67,253,67,203,167,53,97};
//			double[] revenues= new double[monthlyReport.Length] ;//= { 235,99,12,131,12,111,12,191,552,11,12,11};
//			for (int i=0;i<monthlyReport.Length;i++)
//			{
//				//if (i%30 == 0)
//				labels[i]=((int) i+1).ToString();
//				expenses[i]=(double)monthlyReport[i].expense;
//				revenues[i]=(double)monthlyReport[i].revenue;
//			}
//
//			LineItem myCurve = myPane.AddCurve("Expenses",null,expenses,Color.Red);
//			myCurve.Symbol.Size = 8.0F;
//			myCurve.Symbol.Fill = new Fill( Color.White);
//			myCurve.Line.Width = 2.0F;
//
//			myCurve = myPane.AddCurve("Revenues",null,revenues,Color.Green);
//			myCurve.Symbol.Size = 8.0F;
//			myCurve.Symbol.Fill = new Fill( Color.White);
//			myCurve.Line.Width = 2.0F;
//   
//			// Draw the X tics between the labels instead of 
//			// at the labels
//			myPane.XAxis.IsTicsBetweenLabels = false;
//   
//			// Set the XAxis to Text type
//			myPane.XAxis.Type = AxisType.Text;
//			// Set the XAxis labels
//			myPane.XAxis.TextLabels = labels;
//   
//			// Fill the Axis and Pane backgrounds
//			myPane.AxisFill = new Fill( Color.White,
//				Color.FromArgb( 255, 255, 166), 90F );
//			myPane.PaneFill = new Fill( Color.FromArgb( 250, 250, 255) );
//   
//			// Tell ZedGraph to refigure the
//			// axes since the data have changed
//			zg1.AxisChange();
//		}

		private void button1_Click(object sender, System.EventArgs e)
		{
		
		}

		private void menuItem5_Click(object sender, System.EventArgs e)
		{
			View.SetupView configForm = new View.SetupView();
			configForm.ShowDialog();
			if(configForm.DialogResult.Equals(System.Windows.Forms.DialogResult.OK))
				MessageBox.Show(
					"Please restart Mizaniya for the settings to take effect.", 
					"Mizaniya settings modified", 
					MessageBoxButtons.OK, 
					MessageBoxIcon.Information);
		}

		private void accountListBox_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}

        private void tabSharedTxSummary_Enter(object sender, EventArgs e)
        {
            refreshSharedTxSummary();

        }
        
        /// <summary>
        /// Update the shared transaction report.
        /// </summary>
        private void refreshSharedTxSummary()
        {
            Model.UserAmountPair[] rawReport = manager.GenerateSharedTxReport();
            string[] result = new string[rawReport.Length];
            for (int i = 0; i < rawReport.Length; i++)
            {
                result[i] = rawReport[i].ToIOUString();
            }

            sharedBillsText.Lines = result;
        }

        /// <summary>
        /// function called whenever the server is unavailable. Automatically logs out.
        /// </summary>
        private void onServerDisconnected(object sender, MizEventArgs.ServiceDisconnectEventArgs ev)
        {
            Logout();
            MessageBox.Show("The mizaniya service cannot be found.", "Mizaniya disconnected", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

	}


	
	///////////////////////
	#endregion


	#region ICustomTypeDescriptors

	#region TaskPaneDescriptor
	
	/// <summary>
	/// 
	/// </summary>
	public class TaskPaneDescriptor : ICustomTypeDescriptor
	{
		/// <summary>
		/// 
		/// </summary>
		private TaskPane owner;


		/// <summary>
		/// 
		/// </summary>
		/// <param name="owner"></param>
		public TaskPaneDescriptor(TaskPane owner)
		{
			this.owner = owner;
		}
		
		
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public TypeConverter GetConverter()
		{
			return TypeDescriptor.GetConverter(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="attributes"></param>
		/// <returns></returns>
		public EventDescriptorCollection GetEvents(Attribute[] attributes)
		{
			return TypeDescriptor.GetEvents(this.owner, attributes, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		EventDescriptorCollection System.ComponentModel.ICustomTypeDescriptor.GetEvents()
		{
			return TypeDescriptor.GetEvents(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public string GetComponentName()
		{
			return TypeDescriptor.GetComponentName(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="pd"></param>
		/// <returns></returns>
		public object GetPropertyOwner(PropertyDescriptor pd)
		{
			return this.owner;
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public AttributeCollection GetAttributes()
		{
			return TypeDescriptor.GetAttributes(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="attributes"></param>
		/// <returns></returns>
		public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
		{
			PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(this.owner, attributes, true);
			
			PropertyDescriptor[] pd = new PropertyDescriptor[1];
			
			for (int i=0; i<pdc.Count; i++)
			{
				if (pdc[i].Name.Equals("CustomSettings"))
				{
					pd[0] = pdc[i];

					break;
				}
			}

			return new PropertyDescriptorCollection(pd);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		PropertyDescriptorCollection System.ComponentModel.ICustomTypeDescriptor.GetProperties()
		{
			return ((ICustomTypeDescriptor) this).GetProperties(new Attribute[0]);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="editorBaseType"></param>
		/// <returns></returns>
		public object GetEditor(Type editorBaseType)
		{
			return TypeDescriptor.GetEditor(this.owner, editorBaseType, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public PropertyDescriptor GetDefaultProperty()
		{
			return TypeDescriptor.GetDefaultProperty(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public EventDescriptor GetDefaultEvent()
		{
			return TypeDescriptor.GetDefaultEvent(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public string GetClassName()
		{
			return TypeDescriptor.GetClassName(this.owner, true);
		}
	}

	#endregion


	#region ExpandoDescriptor
	
	/// <summary>
	/// 
	/// </summary>
	public class ExpandoDescriptor : ICustomTypeDescriptor
	{
		/// <summary>
		/// 
		/// </summary>
		private Expando owner;


		/// <summary>
		/// 
		/// </summary>
		/// <param name="owner"></param>
		public ExpandoDescriptor(Expando owner)
		{
			this.owner = owner;
		}
		
		
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public TypeConverter GetConverter()
		{
			return TypeDescriptor.GetConverter(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="attributes"></param>
		/// <returns></returns>
		public EventDescriptorCollection GetEvents(Attribute[] attributes)
		{
			return TypeDescriptor.GetEvents(this.owner, attributes, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		EventDescriptorCollection System.ComponentModel.ICustomTypeDescriptor.GetEvents()
		{
			return TypeDescriptor.GetEvents(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public string GetComponentName()
		{
			return TypeDescriptor.GetComponentName(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="pd"></param>
		/// <returns></returns>
		public object GetPropertyOwner(PropertyDescriptor pd)
		{
			return this.owner;
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public AttributeCollection GetAttributes()
		{
			return TypeDescriptor.GetAttributes(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="attributes"></param>
		/// <returns></returns>
		public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
		{
			PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(this.owner, attributes, true);
			
			PropertyDescriptor[] pd = new PropertyDescriptor[9];
			
			for (int i=0; i<pdc.Count; i++)
			{
				if (pdc[i].Name.Equals("Animate"))
				{
					pd[0] = pdc[i];
				}
				else if (pdc[i].Name.Equals("Collapsed"))
				{
					pd[1] = pdc[i];
				}
				else if (pdc[i].Name.Equals("CustomHeaderSettings"))
				{
					pd[2] = pdc[i];
				}
				else if (pdc[i].Name.Equals("CustomSettings"))
				{
					pd[3] = pdc[i];
				}
				else if (pdc[i].Name.Equals("SpecialGroup"))
				{
					pd[4] = pdc[i];
				}
				else if (pdc[i].Name.Equals("TitleImage"))
				{
					pd[5] = pdc[i];
				}
				else if (pdc[i].Name.Equals("Watermark"))
				{
					pd[6] = pdc[i];
				}
				else if (pdc[i].Name.Equals("CanCollapse"))
				{
					pd[7] = pdc[i];
				}
				else if (pdc[i].Name.Equals("Enabled"))
				{
					pd[8] = pdc[i];
				}
			}

			return new PropertyDescriptorCollection(pd);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		PropertyDescriptorCollection System.ComponentModel.ICustomTypeDescriptor.GetProperties()
		{
			return ((ICustomTypeDescriptor) this).GetProperties(new Attribute[0]);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="editorBaseType"></param>
		/// <returns></returns>
		public object GetEditor(Type editorBaseType)
		{
			return TypeDescriptor.GetEditor(this.owner, editorBaseType, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public PropertyDescriptor GetDefaultProperty()
		{
			return TypeDescriptor.GetDefaultProperty(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public EventDescriptor GetDefaultEvent()
		{
			return TypeDescriptor.GetDefaultEvent(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public string GetClassName()
		{
			return TypeDescriptor.GetClassName(this.owner, true);
		}
	}

	#endregion


	#region TaskItemDescriptor
	
	/// <summary>
	/// 
	/// </summary>
	public class TaskItemDescriptor : ICustomTypeDescriptor
	{
		/// <summary>
		/// 
		/// </summary>
		private TaskItem owner;


		/// <summary>
		/// 
		/// </summary>
		/// <param name="owner"></param>
		public TaskItemDescriptor(TaskItem owner)
		{
			this.owner = owner;
		}
		
		
		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public TypeConverter GetConverter()
		{
			return TypeDescriptor.GetConverter(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="attributes"></param>
		/// <returns></returns>
		public EventDescriptorCollection GetEvents(Attribute[] attributes)
		{
			return TypeDescriptor.GetEvents(this.owner, attributes, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		EventDescriptorCollection System.ComponentModel.ICustomTypeDescriptor.GetEvents()
		{
			return TypeDescriptor.GetEvents(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public string GetComponentName()
		{
			return TypeDescriptor.GetComponentName(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="pd"></param>
		/// <returns></returns>
		public object GetPropertyOwner(PropertyDescriptor pd)
		{
			return this.owner;
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public AttributeCollection GetAttributes()
		{
			return TypeDescriptor.GetAttributes(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="attributes"></param>
		/// <returns></returns>
		public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
		{
			PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(this.owner, attributes, true);
			
			PropertyDescriptor[] pd = new PropertyDescriptor[1];
			
			for (int i=0; i<pdc.Count; i++)
			{
				if (pdc[i].Name.Equals("CustomSettings"))
				{
					pd[0] = pdc[i];

					break;
				}
			}

			return new PropertyDescriptorCollection(pd);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		PropertyDescriptorCollection System.ComponentModel.ICustomTypeDescriptor.GetProperties()
		{
			return ((ICustomTypeDescriptor) this).GetProperties(new Attribute[0]);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <param name="editorBaseType"></param>
		/// <returns></returns>
		public object GetEditor(Type editorBaseType)
		{
			return TypeDescriptor.GetEditor(this.owner, editorBaseType, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public PropertyDescriptor GetDefaultProperty()
		{
			return TypeDescriptor.GetDefaultProperty(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public EventDescriptor GetDefaultEvent()
		{
			return TypeDescriptor.GetDefaultEvent(this.owner, true);
		}


		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public string GetClassName()
		{
			return TypeDescriptor.GetClassName(this.owner, true);
		}
	}

	#endregion

	#endregion
}
